package com.equis.architecture.preloader {
	import mx.collections.ArrayCollection;
	

	/**
	 * Base class for batch items.
	 * @see ar.com.mindset.flexy.preloader.BatchItem
	 * @see ar.com.mindset.flexy.preloader.LazyBatchItem
	 * @see ar.com.mindset.flexy.preloader.ServiceBatchItem
	 */
	public class AbstractBatchItem {
		
		protected var requires:Array;
		protected var params:Array;

		public var running:Boolean = false;
		public var complete:Boolean = false;

		protected var preCallback:Function;
		
		public function AbstractBatchItem(_requires:Array) {
			this.requires = _requires;
		}

		public function call(_preCallback:Function):void {
			preCallback = _preCallback;
			running = true;
		}
		
		public function isRequiredComplete():Boolean {
			if(requires == null || requires.length == 0) {
				return true;
			} else {
				var ret:Boolean = true;
				for each(var req:AbstractBatchItem in requires) {
					ret = ret && req.complete;
				}
				
				return ret;
			}
		}

		public function toString():String {
			return "";
		}
	}
}